<div id="product_content" class="product_container pb50">
    <h2 th:text="*{name}"></h2>

    <div id="price" th:if="${#object instanceof T(org.broadleafcommerce.core.catalog.domain.ProductBundle)}">
        <div blc:fsprice="*{salePrice}" th:if="*{onSale}" th:classappend="*{onSale}? 'sale'"></div>
        <div blc:fsprice="*{retailPrice}" th:classappend="*{onSale}? 'has-sale'"></div>
    </div>

    <div class="product_param">
        <dl id="price" th:unless="${#object instanceof T(org.broadleafcommerce.core.catalog.domain.ProductBundle)}">
            <dt>售价：</dt>
            <dd class="p_param">
                <!-- <div blc:fsprice="*{defaultSku.salePrice}" th:if="*{defaultSku.onSale}" th:classappend="*{defaultSku.onSale}? 'sale'"></div>
                <div blc:fsprice="*{defaultSku.foreignPrice}" th:classappend="*{defaultSku.onSale}? 'has-sale'"></div> -->
                <strong blc:fsprice="*{defaultSku.displayedTotalPrice}" th:classappend="*{defaultSku.onSale}? 'has-sale'"></strong>
            </dd>
        </dl>
        <dl class="select_contry">
            <dt></dt>
            <dd class="p_param flag">
                <span>市场价</span>
                <strong blc:fsprice="*{defaultSku.marketPrice}" th:classappend="*{defaultSku.onSale}? 'has-sale'"></strong>
            </dd>
        </dl>
        <div class="" th:unless="*{#lists.isEmpty(upSaleProducts)}" th:remove="tag">
            <dl th:each="entry, iterStat : *{getRelatedProductGroups(upSaleProducts)}" class="pro_filtrate">
	            <dt th:text="${entry.key} + '：'"></dt>
	            <dd class="">
                    <span th:if="${iterStat.index == 0}" class="pro_filter_self">
                        <a th:if="*{media['primary'] != null}">
                            <img th:src="@{*{media['primary'].url} + '?thumbnail'}" th:alt="*{name}" th:title="*{name}" />
                        </a>
                    </span>
	                <span th:each="upSaleProduct : ${entry.value}" th:object="${upSaleProduct.relatedProduct}">
	                    <th:block th:if="*{isActive() and media['primary'] != null}">
	                        <a th:href="@{*{url}}">
                                <img th:src="@{*{media['primary'].url} + '?thumbnail'}" th:alt="*{name}" th:title="*{name}" />
                            </a>
	                    </th:block>
	                </span>
	            </dd>
	        </dl>
        </div>
        <!--/*-->
        <dl>
            <blc:related_products type="UP_SALE" productId="*{id}" />
            <ul th:each="relatedProduct : ${relatedProducts}" th:object="${relatedProduct.product}">
                <a th:href="@{${relatedProduct.product.url}}"><img th:src="@{*{media['primary'].url} + '?thumbnail'}" th:title="*{name}" /></a>
            </ul>
        </dl>
        <!--*/-->
        <dl class="select_num" id="changeNum">
            <dt>数量：</dt>
            <dd class="p_param clearfix">
                <a class="forbid sub">-</a>
                <input type="text" value="1" id="input_num" /><a class="add">+</a>
            </dd>
        </dl>
        <dl class="product_send" th:unless="*{source}==null or *{source} == ''">
            <dt>配送：</dt>
            <dd>本商品由<span th:text="*{source}"></span>拥有及销售</dd>
        </dl>
        <dl class="overseas_send" th:if="${product.isBroad}">
            <img blc:src="@{/img/20_date_send.jpg}" th:alt="20个工作日不到货现金赔付" />
        </dl>
        <!--/*-->
        <dl th:if="${orderItemQty != null and orderItemQty.containsKey(product.id)}">
            <dt th:text="#{product.sold}">Sold</dt>
            <dd th:text="${orderItemQty.get(product.id)}"></dd>
        </dl>
        <!--*/-->
        <div class="product-options" th:substituteby="catalog/partials/productOptions" />
        <div class="product-option-nonjs" th:each="productOption : *{productOptions}" th:object="${productOption}">
            <div class="form50">
                <label th:text="*{label}"></label>
                <select th:name="${'itemAttributes[' + productOption.attributeName + ']'}">
                    <option th:each="optionValue : *{allowedValues}" th:object="${optionValue}" th:text="*{attributeValue}"></option>
                </select>
            </div>
        </div>
        <th:block th:with="checkInventory=*{defaultSku.inventoryType?.type == 'CHECK_QUANTITY'}, 
            availableInventory=${checkInventory ? #object.defaultSku.quantityAvailable != null and #object.defaultSku.quantityAvailable != 0 : true}, 
            inCart=${cart.containsSku(#object.defaultSku) and #lists.isEmpty(product.productOptions)}">
	        <div class="all_buy_btn">
	            <div id="inventory" th:if="${checkInventory}">
                    <div class="invet_num">
    	                <span th:text="#{product.inventory}"></span>
    	                <span th:text="*{defaultSku.quantityAvailable == null ? '0' : defaultSku.quantityAvailable}"></span>
    	                <span>件</span>
                    </div>
                    <div th:if="${!availableInventory}" class="out_of_stock">
                        <a disabled="disabled" class="big-button gray-button"
                            th:text="#{product.outOfStock}">已售完</a>
                    </div>
	            </div>
                <blc:form method="POST" th:action="@{/cart/add}" class="f_cart">
                    <div class="f_pnl" th:class="*{'productActions' + id}">
                        <div class="add_to_cart fc" th:classappend="${!availableInventory}? ' hidden'">
                            <input type="hidden" name="productId" th:value="*{id}" />
                            <input type="hidden" name="quantity" value="1" id="atc_num" />
                            <input type="hidden" name="referralCode" th:if="${param.containsKey('rc')}" th:value="${param.rc[0]}" />
                            <input type="submit" class="addToCart big red" th:value="#{product.buyNow}" />
                        </div>
                        <p class="error" th:if="${param.errorMessage}" th:text="${param.errorMessage[0]}"></p>
                    </div>
                </blc:form>
                <div th:unless="${customer.anonymous}" th:remove="tag">
                    <blc:form method="POST" th:action="@{/account/wishlist/add}" class="f_wish">
                        <div class="product-option-nonjs fc" th:each="productOption : *{productOptions}" th:object="${productOption}">
                            <div class="form50">
                                <label th:text="*{label}"></label>
                                <select th:name="${'itemAttributes[' + productOption.attributeName + ']'}">
                                    <option th:each="optionValue : *{allowedValues}" th:object="${optionValue}" th:text="*{attributeValue}"></option>
                                </select>
                            </div>
                        </div>
                        <div th:class="${'productActions' + product.id}">
                            <blc:named_order orderVar="wishlist" orderName="wishlist" />
                            <div class="in_wishlist" th:classappend="${!wishlist.containsSku(product.defaultSku)}? ' hidden'">
                                <a class="inWishlist small-button gray-button" th:href="@{/account/wishlist}">收藏夹</a>
                            </div>
                            <div class="add_to_wishlist" th:classappend="${wishlist.containsSku(product.defaultSku)}? ' hidden'">
                                <input type="hidden" name="productId" th:value="*{id}" />
                                <input type="hidden" name="quantity" value="1" />
                                <input type="submit" class="addToWishlist small dark" value="放入收藏夹" />
                            </div>
                        </div>
                    </blc:form>
                </div>
	        </div>
        </th:block>
    </div>
    <div class="share">
        <p class="sh_title">
            <a class="" th:if="${customer.anonymous and product.isBroad}" th:href="@{/login}" th:text="#{login.loginBefore}">Login before</a>
            <span th:text="#{product.share}">Share</span><span th:if="*{isBroad}" th:text="#{product.forRebate}"> and get rebate!</span>
            <!-- JiaThis Button BEGIN -->
            <div class="jiathis_style_32x32">
                <a class="jiathis_button_weixin"></a>
                <a class="jiathis_button_tsina"></a>
                <a class="jiathis_button_tqq"></a>
                <a class="jiathis_button_copy"></a>
                <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
            </div>
            <script type="text/javascript" charset="utf-8" th:inline="javascript">
            /*<![CDATA[*/
                var jiathis_config={
                    url:[[${referralURL}]],
                    title:"我发现一个很不错的智能产品！" + [[*{name}]] + "，" + [[*{defaultSku.shortDescription == null?"":defaultSku.shortDescription}]],
                    summary:"\n在「范客生活」就能买到！现在做活动全场包邮，海淘商品20天不到，还能现金赔付。",
                    pic:[[${referralImgURL}]],
                    shortUrl:false,
                    hideMore:false
                    /*data_track_clickback:true*/
                }
            /*]]>*/
            </script>
            <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>
        </p>
    </div>

</div>
